{layout name="main"/}
<div class="wrapper wrapper-content animated fadeInUp">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox">


                <div class="tabs-container">
                    <ul class="nav nav-tabs">
                        <li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true">业务配置</a>
                        </li>
                        <li class=""><a data-toggle="tab" href="#tab-2" aria-expanded="false">系统配置</a>
                        </li>
                    </ul>
                    <div class="tab-content">
                        <div id="tab-1" class="tab-pane active">
                            <div class="panel-body">
                                <div class="ibox-content" style=" border:none">
                                    <form method="post" action="" class="form-horizontal m-t" id="yewuForm">
                                        <input type="hidden" name="type" value="business" />
                                        {volist name="data" id="vo"} 
                                        {if condition="$vo.type eq 'yewu'"}
                                        <div class="form-group">
                                            <label class="col-sm-3 control-label">{$vo.cn} </label>
                                            <div class="col-sm-5">

                                                {if condition="$vo.class eq 'number'"}

                                                <div class="input-group m-b"><span class="input-group-addon">&yen;</span>


                                                    <input type="text" value="{$vo.value}" name="{$vo.en}"  class="form-control"> <span class="input-group-addon">.00</span>

                                                </div>

                                                {elseif  condition="$vo.class eq 'text'"}
                                                <input type="text" value="{$vo.value}" name="{$vo.en}" class="form-control" >
                                                {elseif condition="$vo.class eq 'textarea'"}
                                                <textarea name="{$vo.en}" class="form-control" style="height: 120px;">{$vo.value}</textarea>
                                                {/if}


                                                {if condition="$vo.prompt"}
                                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> {$vo.prompt}</span>
                                                {/if}
                                            </div>
                                        </div>

                                        {/if}
                                        {if condition="$vo.en eq 'business_lowMoneyMultiple'"}
                                        <div class="hr-line-dashed"></div>
                                        {/if}
                                        {/volist}






                                        <div class="hr-line-dashed"></div>







                                        <div class="form-group">
                                            <div class="col-sm-4 col-sm-offset-3">
                                                <button class="btn btn-primary" type="button" onclick="update1()">保存修改</button>
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                        <div id="tab-2" class="tab-pane">
                            <div class="panel-body">
                                <div class="ibox-content" style=" border:none">
                                    <form method="post" action="" class="form-horizontal m-t" id="edit2">
                                        <input type="hidden" name="type" value="sys" />

                                        {volist name="data" id="vo"} 
                                        {if condition="$vo.type eq 'sys'"}
                                        <div class="form-group">
                                            <label class="col-sm-3 control-label">{$vo.cn} </label>
                                            <div class="col-sm-5">

                                                {if condition="$vo.class eq 'number'"}

                                                <div class="input-group m-b"><span class="input-group-addon">&yen;</span>


                                                    <input type="text" value="{$vo.value}" name="{$vo.en}"  class="form-control"> <span class="input-group-addon">.00</span>

                                                </div>

                                                {elseif  condition="$vo.class eq 'text'"}
                                                <input type="text" value="{$vo.value}" name="{$vo.en}" class="form-control" >
                                                {elseif condition="$vo.class eq 'textarea'"}
                                                <textarea name="{$vo.en}" class="form-control" style="height: 120px;">{$vo.value}</textarea>
                                                {elseif condition="$vo.class eq 'select'"}
                                                <select class="form-control" name="{$vo.en}">
                                                    <option value="1"{if  condition="$vo.value eq '1'"} selected="selected"{/if}>开通</option>
                                                    <option value="0"{if  condition="$vo.value eq '0'"} selected="selected"{/if}>关闭</option>
                                                </select>
                                                {/if}


                                                {if condition="$vo.prompt"}
                                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> {$vo.prompt}</span>
                                                {/if}
                                            </div>
                                        </div>


                                        {/if}
                                        {/volist}

                                        <div class="form-group">
                                            <div class="col-sm-4 col-sm-offset-3">
                                                <button class="btn btn-primary"  type="button" onclick="update2()">保存修改</button>
                                            </div>
                                        </div>
                                    </form>
                                </div>   

                            </div>
                        </div>
                    </div>


                </div>


            </div>
        </div>
    </div>

</div>
<script>
    function update1() {

        var articledata = $("#yewuForm").serialize();
        post({
            url: "{:url('/admin/System/edit')}",
            data: articledata,
            success: function (res) {
                swal({
                    title: '成功',
                    text: res.message,
                    type: "success"
                }, function () {

                });
            },
            error: function (error) {
                swal("错误", JSON.parse(error.responseText).message, "error");
            }
        });
    }

    function update2() {

        var articledata = $("#edit2").serialize();
        post({
            url: "{:url('/admin/System/edit')}",
            data: articledata,
            success: function (res) {
                swal({
                    title: '成功',
                    text: res.message,
                    type: "success"
                }, function () {

                });
            },
            error: function (error) {
                swal("错误", JSON.parse(error.responseText).message, "error");
            }
        });
    }
</script>